<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="" xml:lang="">
<head>

  <meta charset="utf-8" />
  <meta http-equiv="X-UA-Compatible" content="IE=edge" />
  <title>Chapter 4 Entropy | The Open Quant Live Book</title>
  <meta name="description" content="Chapter 4 Entropy | The Open Quant Live Book" />
  <meta name="generator" content="bookdown 0.13 and GitBook 2.6.7" />

  <meta property="og:title" content="Chapter 4 Entropy | The Open Quant Live Book" />
  <meta property="og:type" content="book" />
  
  <meta property="og:image" content="./fig/cover.jpg" />
  <meta property="og:description" content="Chapter 4 Entropy | The Open Quant Live Book" />
  <meta name="github-repo" content="souzatharsis/open-quant-live-book" />

  <meta name="twitter:card" content="summary" />
  <meta name="twitter:title" content="Chapter 4 Entropy | The Open Quant Live Book" />
  
  <meta name="twitter:description" content="Chapter 4 Entropy | The Open Quant Live Book" />
  <meta name="twitter:image" content="./fig/cover.jpg" />

<meta name="author" content="OpenQuants.com" />


<meta name="date" content="2019-12-16" />

  <meta name="viewport" content="width=device-width, initial-scale=1" />
  <meta name="apple-mobile-web-app-capable" content="yes" />
  <meta name="apple-mobile-web-app-status-bar-style" content="black" />
  
  
<link rel="prev" href="risk-parity-portfolios.html"/>
<link rel="next" href="how-to-measure-statistical-causality-a-transfer-entropy-approach-with-financial-applications.html"/>
<script src="libs/jquery-2.2.3/jquery.min.js"></script>
<link href="libs/gitbook-2.6.7/css/style.css" rel="stylesheet" />
<link href="libs/gitbook-2.6.7/css/plugin-table.css" rel="stylesheet" />
<link href="libs/gitbook-2.6.7/css/plugin-bookdown.css" rel="stylesheet" />
<link href="libs/gitbook-2.6.7/css/plugin-highlight.css" rel="stylesheet" />
<link href="libs/gitbook-2.6.7/css/plugin-search.css" rel="stylesheet" />
<link href="libs/gitbook-2.6.7/css/plugin-fontsettings.css" rel="stylesheet" />







<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-75703863-2"></script>
<script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());

  gtag('config', 'UA-75703863-2');
</script>


<!-- Hypotheses -->
<!-- <script src="https://hypothes.is/embed.js" async></script> -->


<style type="text/css">
div.sourceCode { overflow-x: auto; }
table.sourceCode, tr.sourceCode, td.lineNumbers, td.sourceCode {
  margin: 0; padding: 0; vertical-align: baseline; border: none; }
table.sourceCode { width: 100%; line-height: 100%; }
td.lineNumbers { text-align: right; padding-right: 4px; padding-left: 4px; color: #aaaaaa; border-right: 1px solid #aaaaaa; }
td.sourceCode { padding-left: 5px; }
code > span.kw { color: #007020; font-weight: bold; } /* Keyword */
code > span.dt { color: #902000; } /* DataType */
code > span.dv { color: #40a070; } /* DecVal */
code > span.bn { color: #40a070; } /* BaseN */
code > span.fl { color: #40a070; } /* Float */
code > span.ch { color: #4070a0; } /* Char */
code > span.st { color: #4070a0; } /* String */
code > span.co { color: #60a0b0; font-style: italic; } /* Comment */
code > span.ot { color: #007020; } /* Other */
code > span.al { color: #ff0000; font-weight: bold; } /* Alert */
code > span.fu { color: #06287e; } /* Function */
code > span.er { color: #ff0000; font-weight: bold; } /* Error */
code > span.wa { color: #60a0b0; font-weight: bold; font-style: italic; } /* Warning */
code > span.cn { color: #880000; } /* Constant */
code > span.sc { color: #4070a0; } /* SpecialChar */
code > span.vs { color: #4070a0; } /* VerbatimString */
code > span.ss { color: #bb6688; } /* SpecialString */
code > span.im { } /* Import */
code > span.va { color: #19177c; } /* Variable */
code > span.cf { color: #007020; font-weight: bold; } /* ControlFlow */
code > span.op { color: #666666; } /* Operator */
code > span.bu { } /* BuiltIn */
code > span.ex { } /* Extension */
code > span.pp { color: #bc7a00; } /* Preprocessor */
code > span.at { color: #7d9029; } /* Attribute */
code > span.do { color: #ba2121; font-style: italic; } /* Documentation */
code > span.an { color: #60a0b0; font-weight: bold; font-style: italic; } /* Annotation */
code > span.cv { color: #60a0b0; font-weight: bold; font-style: italic; } /* CommentVar */
code > span.in { color: #60a0b0; font-weight: bold; font-style: italic; } /* Information */
</style>

<link rel="stylesheet" href="custom_style.css" type="text/css" />
</head>

<body>



  <div class="book without-animation with-summary font-size-2 font-family-1" data-basepath=".">

    <div class="book-summary">
      <nav role="navigation">

<ul class="summary">
<li><a href="./">The Open Quant Live Book</a></li>

<li class="divider"></li>
<li class="chapter" data-level="" data-path="index.html"><a href="index.html"><i class="fa fa-check"></i>Preface</a><ul>
<li class="chapter" data-level="" data-path="index.html"><a href="index.html#description"><i class="fa fa-check"></i>Description</a></li>
<li class="chapter" data-level="" data-path="index.html"><a href="index.html#contribute"><i class="fa fa-check"></i>Contribute</a></li>
<li class="chapter" data-level="" data-path="index.html"><a href="index.html#working-contents"><i class="fa fa-check"></i>Working Contents</a></li>
<li class="chapter" data-level="" data-path="index.html"><a href="index.html#books-information"><i class="fa fa-check"></i>Book’s information</a></li>
</ul></li>
<li class="part"><span><b>I The Basics</b></span></li>
<li class="chapter" data-level="1" data-path="io.html"><a href="io.html"><i class="fa fa-check"></i><b>1</b> I/O</a><ul>
<li class="chapter" data-level="1.1" data-path="io.html"><a href="io.html#importing-data"><i class="fa fa-check"></i><b>1.1</b> Importing Data</a><ul>
<li class="chapter" data-level="1.1.1" data-path="io.html"><a href="io.html#text-files"><i class="fa fa-check"></i><b>1.1.1</b> Text Files</a></li>
<li class="chapter" data-level="1.1.2" data-path="io.html"><a href="io.html#excel-files"><i class="fa fa-check"></i><b>1.1.2</b> Excel Files</a></li>
<li class="chapter" data-level="1.1.3" data-path="io.html"><a href="io.html#json-files"><i class="fa fa-check"></i><b>1.1.3</b> JSON Files</a></li>
<li class="chapter" data-level="1.1.4" data-path="io.html"><a href="io.html#large-files"><i class="fa fa-check"></i><b>1.1.4</b> Large Files</a></li>
</ul></li>
<li class="chapter" data-level="1.2" data-path="io.html"><a href="io.html#data-sources"><i class="fa fa-check"></i><b>1.2</b> Data Sources</a><ul>
<li class="chapter" data-level="1.2.1" data-path="io.html"><a href="io.html#alpha-vantage"><i class="fa fa-check"></i><b>1.2.1</b> Alpha Vantage</a></li>
<li class="chapter" data-level="1.2.2" data-path="io.html"><a href="io.html#iex"><i class="fa fa-check"></i><b>1.2.2</b> IEX</a></li>
<li class="chapter" data-level="1.2.3" data-path="io.html"><a href="io.html#quandl"><i class="fa fa-check"></i><b>1.2.3</b> Quandl</a></li>
<li class="chapter" data-level="1.2.4" data-path="io.html"><a href="io.html#sec"><i class="fa fa-check"></i><b>1.2.4</b> SEC</a></li>
</ul></li>
<li class="chapter" data-level="1.3" data-path="io.html"><a href="io.html#conclusion"><i class="fa fa-check"></i><b>1.3</b> Conclusion</a><ul>
<li class="chapter" data-level="1.3.1" data-path="io.html"><a href="io.html#further-reading"><i class="fa fa-check"></i><b>1.3.1</b> Further Reading</a></li>
</ul></li>
</ul></li>
<li class="chapter" data-level="2" data-path="stylized-facts.html"><a href="stylized-facts.html"><i class="fa fa-check"></i><b>2</b> Stylized Facts</a><ul>
<li class="chapter" data-level="2.1" data-path="stylized-facts.html"><a href="stylized-facts.html#introduction"><i class="fa fa-check"></i><b>2.1</b> Introduction</a></li>
<li class="chapter" data-level="2.2" data-path="stylized-facts.html"><a href="stylized-facts.html#distribution-of-returns"><i class="fa fa-check"></i><b>2.2</b> Distribution of Returns</a><ul>
<li class="chapter" data-level="2.2.1" data-path="stylized-facts.html"><a href="stylized-facts.html#fat-tails"><i class="fa fa-check"></i><b>2.2.1</b> Fat Tails</a></li>
<li class="chapter" data-level="2.2.2" data-path="stylized-facts.html"><a href="stylized-facts.html#skewness"><i class="fa fa-check"></i><b>2.2.2</b> Skewness</a></li>
</ul></li>
<li class="chapter" data-level="2.3" data-path="stylized-facts.html"><a href="stylized-facts.html#volatility"><i class="fa fa-check"></i><b>2.3</b> Volatility</a><ul>
<li class="chapter" data-level="2.3.1" data-path="stylized-facts.html"><a href="stylized-facts.html#time-invariance"><i class="fa fa-check"></i><b>2.3.1</b> Time-invariance</a></li>
<li class="chapter" data-level="2.3.2" data-path="stylized-facts.html"><a href="stylized-facts.html#volatility-clustering"><i class="fa fa-check"></i><b>2.3.2</b> Volatility Clustering</a></li>
<li class="chapter" data-level="2.3.3" data-path="stylized-facts.html"><a href="stylized-facts.html#correlation-with-trading-volume"><i class="fa fa-check"></i><b>2.3.3</b> Correlation with Trading Volume</a></li>
</ul></li>
<li class="chapter" data-level="2.4" data-path="stylized-facts.html"><a href="stylized-facts.html#correlation"><i class="fa fa-check"></i><b>2.4</b> Correlation</a><ul>
<li class="chapter" data-level="2.4.1" data-path="stylized-facts.html"><a href="stylized-facts.html#time-invariance-1"><i class="fa fa-check"></i><b>2.4.1</b> Time-invariance</a></li>
<li class="chapter" data-level="2.4.2" data-path="stylized-facts.html"><a href="stylized-facts.html#auto-correlation"><i class="fa fa-check"></i><b>2.4.2</b> Auto-correlation</a></li>
</ul></li>
</ul></li>
<li class="part"><span><b>II Algo Trading</b></span></li>
<li class="part"><span><b>III Portfolio Optimization</b></span></li>
<li class="chapter" data-level="3" data-path="risk-parity-portfolios.html"><a href="risk-parity-portfolios.html"><i class="fa fa-check"></i><b>3</b> Risk Parity Portfolios</a><ul>
<li class="chapter" data-level="3.1" data-path="risk-parity-portfolios.html"><a href="risk-parity-portfolios.html#introduction-1"><i class="fa fa-check"></i><b>3.1</b> Introduction</a></li>
<li class="chapter" data-level="3.2" data-path="risk-parity-portfolios.html"><a href="risk-parity-portfolios.html#risk-parity-portfolio"><i class="fa fa-check"></i><b>3.2</b> Risk Parity Portfolio</a></li>
<li class="chapter" data-level="3.3" data-path="risk-parity-portfolios.html"><a href="risk-parity-portfolios.html#tangency-portfolio"><i class="fa fa-check"></i><b>3.3</b> Tangency Portfolio</a></li>
<li class="chapter" data-level="3.4" data-path="risk-parity-portfolios.html"><a href="risk-parity-portfolios.html#optimizing-faang-ray-dalio-versus-markowitz"><i class="fa fa-check"></i><b>3.4</b> Optimizing FAANG: Ray Dalio versus Markowitz</a><ul>
<li class="chapter" data-level="3.4.1" data-path="risk-parity-portfolios.html"><a href="risk-parity-portfolios.html#single-portfolio"><i class="fa fa-check"></i><b>3.4.1</b> Single Portfolio</a></li>
<li class="chapter" data-level="3.4.2" data-path="risk-parity-portfolios.html"><a href="risk-parity-portfolios.html#the-ray-dalio-faang-index"><i class="fa fa-check"></i><b>3.4.2</b> The Ray Dalio FAANG Index</a></li>
</ul></li>
<li class="chapter" data-level="3.5" data-path="risk-parity-portfolios.html"><a href="risk-parity-portfolios.html#discussion-and-conclusion"><i class="fa fa-check"></i><b>3.5</b> Discussion and Conclusion</a></li>
</ul></li>
<li class="part"><span><b>IV Machine Learning</b></span></li>
<li class="part"><span><b>V Econophysics</b></span></li>
<li class="chapter" data-level="4" data-path="entropy.html"><a href="entropy.html"><i class="fa fa-check"></i><b>4</b> Entropy</a><ul>
<li class="chapter" data-level="4.1" data-path="entropy.html"><a href="entropy.html#introduction-2"><i class="fa fa-check"></i><b>4.1</b> Introduction</a></li>
<li class="chapter" data-level="4.2" data-path="entropy.html"><a href="entropy.html#nonlinear-coupling"><i class="fa fa-check"></i><b>4.2</b> Nonlinear Coupling</a><ul>
<li class="chapter" data-level="4.2.1" data-path="entropy.html"><a href="entropy.html#simulated-systems"><i class="fa fa-check"></i><b>4.2.1</b> Simulated Systems</a></li>
<li class="chapter" data-level="4.2.2" data-path="entropy.html"><a href="entropy.html#equity-commodities-relationship"><i class="fa fa-check"></i><b>4.2.2</b> Equity-Commodities Relationship</a></li>
</ul></li>
<li class="chapter" data-level="4.3" data-path="entropy.html"><a href="entropy.html#efficiency-and-bubbles-a-case-study-in-the-crypto-and-equity-markets"><i class="fa fa-check"></i><b>4.3</b> Efficiency and Bubbles: A Case Study in the Crypto and Equity Markets</a></li>
</ul></li>
<li class="chapter" data-level="5" data-path="how-to-measure-statistical-causality-a-transfer-entropy-approach-with-financial-applications.html"><a href="how-to-measure-statistical-causality-a-transfer-entropy-approach-with-financial-applications.html"><i class="fa fa-check"></i><b>5</b> How to Measure Statistical Causality: A Transfer Entropy Approach with Financial Applications</a><ul>
<li class="chapter" data-level="5.1" data-path="how-to-measure-statistical-causality-a-transfer-entropy-approach-with-financial-applications.html"><a href="how-to-measure-statistical-causality-a-transfer-entropy-approach-with-financial-applications.html#LinearG"><i class="fa fa-check"></i><b>5.1</b> A First Definition of Causality</a></li>
<li class="chapter" data-level="5.2" data-path="how-to-measure-statistical-causality-a-transfer-entropy-approach-with-financial-applications.html"><a href="how-to-measure-statistical-causality-a-transfer-entropy-approach-with-financial-applications.html#a-probabilistic-based-definition"><i class="fa fa-check"></i><b>5.2</b> A Probabilistic-Based Definition</a></li>
<li class="chapter" data-level="5.3" data-path="how-to-measure-statistical-causality-a-transfer-entropy-approach-with-financial-applications.html"><a href="how-to-measure-statistical-causality-a-transfer-entropy-approach-with-financial-applications.html#nonlinearG"><i class="fa fa-check"></i><b>5.3</b> Transfer Entropy and Statistical Causality</a></li>
<li class="chapter" data-level="5.4" data-path="how-to-measure-statistical-causality-a-transfer-entropy-approach-with-financial-applications.html"><a href="how-to-measure-statistical-causality-a-transfer-entropy-approach-with-financial-applications.html#net-information-flow"><i class="fa fa-check"></i><b>5.4</b> Net Information Flow</a></li>
<li class="chapter" data-level="5.5" data-path="how-to-measure-statistical-causality-a-transfer-entropy-approach-with-financial-applications.html"><a href="how-to-measure-statistical-causality-a-transfer-entropy-approach-with-financial-applications.html#the-link-between-granger-causality-and-transfer-entropy"><i class="fa fa-check"></i><b>5.5</b> The Link Between Granger-causality and Transfer Entropy</a></li>
<li class="chapter" data-level="5.6" data-path="how-to-measure-statistical-causality-a-transfer-entropy-approach-with-financial-applications.html"><a href="how-to-measure-statistical-causality-a-transfer-entropy-approach-with-financial-applications.html#information-flow-on-simulated-systems"><i class="fa fa-check"></i><b>5.6</b> Information Flow on Simulated Systems</a></li>
<li class="chapter" data-level="5.7" data-path="how-to-measure-statistical-causality-a-transfer-entropy-approach-with-financial-applications.html"><a href="how-to-measure-statistical-causality-a-transfer-entropy-approach-with-financial-applications.html#information-flow-among-international-stock-market-indices"><i class="fa fa-check"></i><b>5.7</b> Information Flow among International Stock Market Indices</a></li>
<li class="chapter" data-level="5.8" data-path="how-to-measure-statistical-causality-a-transfer-entropy-approach-with-financial-applications.html"><a href="how-to-measure-statistical-causality-a-transfer-entropy-approach-with-financial-applications.html#other-applications"><i class="fa fa-check"></i><b>5.8</b> Other Applications</a><ul>
<li class="chapter" data-level="5.8.1" data-path="how-to-measure-statistical-causality-a-transfer-entropy-approach-with-financial-applications.html"><a href="how-to-measure-statistical-causality-a-transfer-entropy-approach-with-financial-applications.html#quantifying-information-flow-between-social-media-and-the-stock-market"><i class="fa fa-check"></i><b>5.8.1</b> Quantifying Information Flow Between Social Media and the Stock Market</a></li>
<li class="chapter" data-level="5.8.2" data-path="how-to-measure-statistical-causality-a-transfer-entropy-approach-with-financial-applications.html"><a href="how-to-measure-statistical-causality-a-transfer-entropy-approach-with-financial-applications.html#detecting-causal-links-between-investor-sentiment-and-cryptocurrency-prices"><i class="fa fa-check"></i><b>5.8.2</b> Detecting Causal Links Between Investor Sentiment and Cryptocurrency Prices</a></li>
</ul></li>
<li class="chapter" data-level="5.9" data-path="how-to-measure-statistical-causality-a-transfer-entropy-approach-with-financial-applications.html"><a href="how-to-measure-statistical-causality-a-transfer-entropy-approach-with-financial-applications.html#conclusions"><i class="fa fa-check"></i><b>5.9</b> Conclusions</a></li>
</ul></li>
<li class="chapter" data-level="6" data-path="financial-networks.html"><a href="financial-networks.html"><i class="fa fa-check"></i><b>6</b> Financial Networks</a><ul>
<li class="chapter" data-level="6.1" data-path="financial-networks.html"><a href="financial-networks.html#introduction-3"><i class="fa fa-check"></i><b>6.1</b> Introduction</a></li>
<li class="chapter" data-level="6.2" data-path="financial-networks.html"><a href="financial-networks.html#network-construction"><i class="fa fa-check"></i><b>6.2</b> Network Construction</a><ul>
<li class="chapter" data-level="6.2.1" data-path="financial-networks.html"><a href="financial-networks.html#network-filtering-asset-graphs"><i class="fa fa-check"></i><b>6.2.1</b> Network Filtering: Asset Graphs</a></li>
<li class="chapter" data-level="6.2.2" data-path="financial-networks.html"><a href="financial-networks.html#network-filtering-mst"><i class="fa fa-check"></i><b>6.2.2</b> Network Filtering: MST</a></li>
<li class="chapter" data-level="6.2.3" data-path="financial-networks.html"><a href="financial-networks.html#network-filtering-pmfg"><i class="fa fa-check"></i><b>6.2.3</b> Network Filtering: PMFG</a></li>
</ul></li>
<li class="chapter" data-level="6.3" data-path="financial-networks.html"><a href="financial-networks.html#applications"><i class="fa fa-check"></i><b>6.3</b> Applications</a><ul>
<li class="chapter" data-level="6.3.1" data-path="financial-networks.html"><a href="financial-networks.html#industry-taxonomy"><i class="fa fa-check"></i><b>6.3.1</b> Industry Taxonomy</a></li>
<li class="chapter" data-level="6.3.2" data-path="financial-networks.html"><a href="financial-networks.html#portfolio-construction"><i class="fa fa-check"></i><b>6.3.2</b> Portfolio Construction</a></li>
</ul></li>
</ul></li>
<li class="part"><span><b>VI Alternative Data</b></span></li>
<li class="chapter" data-level="7" data-path="the-market-the-players-and-the-rules.html"><a href="the-market-the-players-and-the-rules.html"><i class="fa fa-check"></i><b>7</b> The Market, The Players and The Rules</a><ul>
<li class="chapter" data-level="7.1" data-path="the-market-the-players-and-the-rules.html"><a href="the-market-the-players-and-the-rules.html#the-market"><i class="fa fa-check"></i><b>7.1</b> The Market</a></li>
<li class="chapter" data-level="7.2" data-path="the-market-the-players-and-the-rules.html"><a href="the-market-the-players-and-the-rules.html#the-data"><i class="fa fa-check"></i><b>7.2</b> The Data</a></li>
<li class="chapter" data-level="7.3" data-path="the-market-the-players-and-the-rules.html"><a href="the-market-the-players-and-the-rules.html#the-buyers"><i class="fa fa-check"></i><b>7.3</b> The Buyers</a></li>
<li class="chapter" data-level="7.4" data-path="the-market-the-players-and-the-rules.html"><a href="the-market-the-players-and-the-rules.html#conclusion-1"><i class="fa fa-check"></i><b>7.4</b> Conclusion</a></li>
</ul></li>
<li class="appendix"><span><b>Appendix</b></span></li>
<li class="chapter" data-level="A" data-path="statistical-methods.html"><a href="statistical-methods.html"><i class="fa fa-check"></i><b>A</b> Statistical Methods</a><ul>
<li class="chapter" data-level="A.1" data-path="statistical-methods.html"><a href="statistical-methods.html#kde"><i class="fa fa-check"></i><b>A.1</b> Kernel Density Estimation</a></li>
</ul></li>
<li class="chapter" data-level="B" data-path="datasets.html"><a href="datasets.html"><i class="fa fa-check"></i><b>B</b> Datasets</a><ul>
<li class="chapter" data-level="B.1" data-path="datasets.html"><a href="datasets.html#dt-indices"><i class="fa fa-check"></i><b>B.1</b> Log-Returns of International Stock Market Indices Prices</a><ul>
<li class="chapter" data-level="B.1.1" data-path="datasets.html"><a href="datasets.html#dataset-location"><i class="fa fa-check"></i><b>B.1.1</b> Dataset Location</a></li>
<li class="chapter" data-level="B.1.2" data-path="datasets.html"><a href="datasets.html#dataset-description"><i class="fa fa-check"></i><b>B.1.2</b> Dataset Description</a></li>
<li class="chapter" data-level="B.1.3" data-path="datasets.html"><a href="datasets.html#data-source"><i class="fa fa-check"></i><b>B.1.3</b> Data Source</a></li>
<li class="chapter" data-level="B.1.4" data-path="datasets.html"><a href="datasets.html#code"><i class="fa fa-check"></i><b>B.1.4</b> Code</a></li>
<li class="chapter" data-level="B.1.5" data-path="datasets.html"><a href="datasets.html#dataset-scheme"><i class="fa fa-check"></i><b>B.1.5</b> Dataset Scheme</a></li>
</ul></li>
<li class="chapter" data-level="B.2" data-path="datasets.html"><a href="datasets.html#dt-FAANG"><i class="fa fa-check"></i><b>B.2</b> Log-Returns of FAANG Prices</a><ul>
<li class="chapter" data-level="B.2.1" data-path="datasets.html"><a href="datasets.html#dataset-location-1"><i class="fa fa-check"></i><b>B.2.1</b> Dataset Location</a></li>
<li class="chapter" data-level="B.2.2" data-path="datasets.html"><a href="datasets.html#dataset-description-1"><i class="fa fa-check"></i><b>B.2.2</b> Dataset Description</a></li>
<li class="chapter" data-level="B.2.3" data-path="datasets.html"><a href="datasets.html#data-source-1"><i class="fa fa-check"></i><b>B.2.3</b> Data Source</a></li>
<li class="chapter" data-level="B.2.4" data-path="datasets.html"><a href="datasets.html#code-1"><i class="fa fa-check"></i><b>B.2.4</b> Code</a></li>
<li class="chapter" data-level="B.2.5" data-path="datasets.html"><a href="datasets.html#dataset-scheme-1"><i class="fa fa-check"></i><b>B.2.5</b> Dataset Scheme</a></li>
</ul></li>
</ul></li>
<li class="chapter" data-level="" data-path="references.html"><a href="references.html"><i class="fa fa-check"></i>References</a></li>
<li class="divider"></li>
<li><a href="https://creativecommons.org/licenses/by/4.0/" target="blank">CC-BY 4.0</a></li>
<li><a href="https://github.com/souzatharsis/open-quant-live-book" target="blank">See source code on Github</a></li>

</ul>

      </nav>
    </div>

    <div class="book-body">
      <div class="body-inner">
        <div class="book-header" role="navigation">
          <h1>
            <i class="fa fa-circle-o-notch fa-spin"></i><a href="./">The Open Quant Live Book</a>
          </h1>
        </div>

        <div class="page-wrapper" tabindex="-1" role="main">
          <div class="page-inner">

            <section class="normal" id="section-">
<div id="entropy" class="section level1">
<h1><span class="header-section-number">Chapter 4</span> Entropy</h1>
<div id="introduction-2" class="section level2">
<h2><span class="header-section-number">4.1</span> Introduction</h2>
Let <span class="math inline">\(X\)</span> be a random variable and <span class="math inline">\(P_X(x)\)</span> be its probability density function (pdf). The entropy <span class="math inline">\(H(X)\)</span> can be interpreted sa measure of the uncertainty of <span class="math inline">\(X\)</span> and is defined in the discrete case as follows:
<span class="math display">\[\begin{equation}
H(X) = -\sum_{x \in X}{P_X(x)\log{P_X(x)}}.
\label{eq:H}
\end{equation}\]</span>
<p>If the <span class="math inline">\(\log\)</span> is taken to base two, then the unit of <span class="math inline">\(H\)</span> is the  (binary digit). We employ the natural logarithm which implies the unit in  (natural unit of information).</p>
</div>
<div id="nonlinear-coupling" class="section level2">
<h2><span class="header-section-number">4.2</span> Nonlinear Coupling</h2>
<p>Entropy works well when describing the order, uncertainty or variability of a unique variable, however it cannot work properly for more than one variable. This is where joint entropy, mutual information and conditional entropy come in.</p>
Given a coupled system <span class="math inline">\((X,Y)\)</span>, where <span class="math inline">\(P_Y(y)\)</span> is the pdf of the random variable <span class="math inline">\(Y\)</span> and <span class="math inline">\(P_{X,Y}\)</span> the joint pdf between <span class="math inline">\(X\)</span> and <span class="math inline">\(Y\)</span>, the joint entropy is given by:
<span class="math display">\[\begin{equation}
H(X,Y) = -\sum_{x \in X}{\sum_{y \in Y}{P_{X,Y}(x,y)\log{\frac{P_{X,Y}(x,y)}{P_X(x)}}}}.
\label{eq:HXY}
\end{equation}\]</span>
The conditional entropy is defined by:
<span class="math display">\[\begin{equation}
H\left(X\middle\vert Y\right) = H(X,Y) - H(X).
\end{equation}\]</span>
We can interpret <span class="math inline">\(H\left(Y\middle\vert X\right)\)</span> as the uncertainty of <span class="math inline">\(Y\)</span> given a realization of <span class="math inline">\(X\)</span>. The average amount by which a measurement of <span class="math inline">\(X\)</span> reduces the uncertainty of <span class="math inline">\(Y\)</span> is the mutual information:
<span class="math display">\[\begin{align}
I(Y, X) &amp;= H(Y) - H\left(Y\middle\vert X\right) \\
&amp;=\sum_{x \in X}{\sum_{y \in Y}{P_{X,Y}(x,y)\log{\frac{P_{X,Y}(x,y)}{P_X(x)P_Y(y)}}}}.
\end{align}\]</span>
<p>Noticed that, by definition, mutual information is symmetric and non-negative. We have <span class="math inline">\(I(X,Y) = 0\)</span> if and only if <span class="math inline">\(X\)</span> and <span class="math inline">\(Y\)</span> are statistically independent. Therefore, the mutual information between <span class="math inline">\(X\)</span> and <span class="math inline">\(Y\)</span> can be considered a measure of dependence between these variables, with both linear and non linear generalization.</p>
Mutual information is a measure that ranges from zero to infinite. A common scaling method <span class="citation">(Lin and Granger <a href="#ref-doi:10.1002/for.3980130102">1994</a>)</span> defines a normalized global correlation coefficient given by
<span class="math display">\[\begin{equation}
\lambda = \sqrt{1 - exp^{-2I(X,Y)}},
\end{equation}\]</span>
<p>such that <span class="math inline">\(\lambda \in [-1, 1]\)</span>. This normalization allows us to have a mutual information-based correlation measure that has the same scale as other traditional correlation measures such as Pearson’s or Kendall’s correlation.</p>
<div id="simulated-systems" class="section level3">
<h3><span class="header-section-number">4.2.1</span> Simulated Systems</h3>
</div>
<div id="equity-commodities-relationship" class="section level3">
<h3><span class="header-section-number">4.2.2</span> Equity-Commodities Relationship</h3>
<p>GSCI is widely recognised as a leading measure of general price movements. It provides investors with a reliable and publicly-available benchmark for investment performance in the commodity markets.</p>
<p>A commodity index measures the returns of a passive investment strategy which has the following characteristics:</p>
<ul>
<li>Holds only long positions in commodity futures</li>
<li>Uses only real assets</li>
<li>Fully collateralises those futures positions</li>
<li>Passively allocates a variety of commodity futures, taking no active view on individual commodities</li>
</ul>
</div>
</div>
<div id="efficiency-and-bubbles-a-case-study-in-the-crypto-and-equity-markets" class="section level2">
<h2><span class="header-section-number">4.3</span> Efficiency and Bubbles: A Case Study in the Crypto and Equity Markets</h2>

</div>
</div>
<h3>References</h3>
<div id="refs" class="references">
<div id="ref-doi:10.1002/for.3980130102">
<p>Lin, Jin-Lung, and C. W. J. Granger. 1994. “Forecasting from Non-Linear Models in Practice.” <em>Journal of Forecasting</em> 13 (1): 1–9. doi:<a href="https://doi.org/10.1002/for.3980130102">10.1002/for.3980130102</a>.</p>
</div>
</div>
            </section>

          </div>
        </div>
      </div>
<a href="risk-parity-portfolios.html" class="navigation navigation-prev " aria-label="Previous page"><i class="fa fa-angle-left"></i></a>
<a href="how-to-measure-statistical-causality-a-transfer-entropy-approach-with-financial-applications.html" class="navigation navigation-next " aria-label="Next page"><i class="fa fa-angle-right"></i></a>
    </div>
  </div>
<script src="libs/gitbook-2.6.7/js/app.min.js"></script>
<script src="libs/gitbook-2.6.7/js/lunr.js"></script>
<script src="libs/gitbook-2.6.7/js/plugin-search.js"></script>
<script src="libs/gitbook-2.6.7/js/plugin-sharing.js"></script>
<script src="libs/gitbook-2.6.7/js/plugin-fontsettings.js"></script>
<script src="libs/gitbook-2.6.7/js/plugin-bookdown.js"></script>
<script src="libs/gitbook-2.6.7/js/jquery.highlight.js"></script>
<script>
gitbook.require(["gitbook"], function(gitbook) {
gitbook.start({
"sharing": {
"github": false,
"facebook": true,
"twitter": true,
"google": false,
"linkedin": true,
"weibo": false,
"instapaper": false,
"vk": false,
"all": ["facebook", "google", "twitter", "linkedin", "weibo", "instapaper"]
},
"fontsettings": {
"theme": "white",
"family": "sans",
"size": 2
},
"edit": {
"link": "https://github.com/souzatharsis/open-quant-live-book/edit/master/chapters/Entropy/Entropy.Rmd",
"text": "Edit"
},
"history": {
"link": null,
"text": null
},
"download": ["open-quant-live-book.epub"],
"toc": {
"collapse": "subsection",
"scroll_highlight": true
}
});
});
</script>

<!-- dynamically load mathjax for compatibility with self-contained -->
<script>
  (function () {
    var script = document.createElement("script");
    script.type = "text/javascript";
    var src = "";
    if (src === "" || src === "true") src = "https://mathjax.rstudio.com/latest/MathJax.js?config=TeX-MML-AM_CHTML";
    if (location.protocol !== "file:")
      if (/^https?:/.test(src))
        src = src.replace(/^https?:/, '');
    script.src = src;
    document.getElementsByTagName("head")[0].appendChild(script);
  })();
</script>
</body>

</html>
